package com.woniuxy.factory.service.imp;

import com.woniuxy.factory.entity.MateralDetailed;
import com.woniuxy.factory.mapper.MateralDetailedMapper;
import com.woniuxy.factory.service.MateralDetailedService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MateralDetailedServiceImp implements MateralDetailedService {

    @Autowired(required = false)
    MateralDetailedMapper mdm;

    //新增领料
    @Override
    public void insertMateralDetailed(MateralDetailed md) {
        mdm.insertMateralDetailed(md);
    }

    //明细查询
    @Override
    public List<MateralDetailed> selectAllDetailedMaterial(MateralDetailed materalDetailed,int page,int limit) {
        //设置起始索引页
        page = (page-1)*limit;
        List<MateralDetailed> lmd = mdm.selectAllDetailedMaterial(materalDetailed,page,limit);
        return lmd;
    }

    //删除记录
    @Override
    public void deleteDetailedDaterial(String madId) {
        mdm.deleteDetailedDaterial(madId);
    }

    //查询总数
    @Override
    public int selectDetailedMaterialSum(MateralDetailed materalDetailed) {
        int count = mdm.selectDetailedMaterialSum(materalDetailed);
        return count;
    }
}
